
#include "ClassColor.h"

ClassColor::ClassColor() : BClass("Color", true)
{

	this->insertMethod("Color()", &ClassColor::create);
	this->insertMethod("Color(byte c, byte a = 255)", &ClassColor::create_c_a);
	this->insertMethod("Color(byte r, byte g, byte b, byte a = 255)", &ClassColor::create_r_g_b_a);
	this->insertMethod("Color(Color)", &ClassColor::create_color);

	this->insertMethod("void reset()", &ClassColor::reset);

	this->insertMethod("void set(byte,byte)", &ClassColor::set_c_a);
	this->insertMethod("void set(byte,byte,byte,byte)", &ClassColor::set_r_g_b_a);

	this->insertMethod("byte r() const", &ClassColor::r);
	this->insertMethod("byte g() const", &ClassColor::g);
	this->insertMethod("byte b() const", &ClassColor::b);
	this->insertMethod("byte a() const", &ClassColor::a);

	this->insertMethod("byte gray() const", &ClassColor::gray);
	this->insertMethod("Color reverse() const", &ClassColor::reverse);
	this->insertMethod("Color inverse() const", &ClassColor::inverse);

	this->insertMethod("void =(Color)", &ClassColor::assign_color);

	this->insertMethod("bool != (Color) const", &ClassColor::equal);
	this->insertMethod("bool == (Color) const", &ClassColor::unequal);

	this->insertMethod("bool < (Color) const", &ClassColor::less);
	this->insertMethod("bool <= (Color) const", &ClassColor::less_equal);

	this->insertMethod("bool > (Color) const", &ClassColor::greater);
	this->insertMethod("bool >= (Color) const", &ClassColor::greater_equal);

	this->insertMethod("Color + (byte) const", &ClassColor::plus_byte);
	this->insertMethod("Color + (Color) const", &ClassColor::plus_color);

	this->insertMethod("void += (byte)", &ClassColor::plus_assign_byte);
	this->insertMethod("void += (Color)", &ClassColor::plus_assign_color);

	this->insertMethod("Color - (byte) const", &ClassColor::minus_byte);
	this->insertMethod("Color - (Color) const", &ClassColor::minus_color);

	this->insertMethod("void -= (byte)", &ClassColor::minus_assign_byte);
	this->insertMethod("void -= (Color)", &ClassColor::minus_assign_color);

	this->insertMethod("Color * (auto) const", &ClassColor::mult);
	this->insertMethod("void *= (auto)", &ClassColor::mult_assign);

	this->insertMethod("Color / (auto) const", &ClassColor::div);
	this->insertMethod("void /= (auto)", &ClassColor::div_assign);

	this->insertMethod("Color % (auto) const", &ClassColor::mod);
	this->insertMethod("void %= (auto)", &ClassColor::mod_assign);

}

void ClassColor::create(int argc, BValue* argv)
{
	argv[0].refer() = BColor();
}
void ClassColor::create_c_a(int argc, BValue* argv)
{
	BByte c = argv[1];
	BByte a = argv[4];
	argv[0].refer() = BColor(c, a);
}
void ClassColor::create_r_g_b_a(int argc, BValue* argv)
{
	BByte r = argv[1];
	BByte g = argv[2];
	BByte b = argv[3];
	BByte a = argv[4];
	argv[0].refer() = BColor(r, g, b, a);
}
void ClassColor::create_color(int argc, BValue* argv)
{
	BColor& color = argv[0];
	BColor other = argv[1];
	color = other;
}

void ClassColor::reset(int argc, BValue* argv)
{
	BColor& color = argv[0];
	color.reset();
}

void ClassColor::set_c_a(int argc, BValue* argv)
{
	BColor& color = argv[0];
	BByte c = argv[1];
	BByte a = argv[2];
	color.set(c, a);
}
void ClassColor::set_r_g_b_a(int argc, BValue* argv)
{
	BColor& color = argv[0];
	BByte r = argv[1];
	BByte g = argv[2];
	BByte b = argv[3];
	BByte a = argv[4];
	color.set(r, g, b, a);
}

void ClassColor::r(int argc, BValue* argv)
{
	const BColor& color = argv[0];
	argv[0] = color.r();
}
void ClassColor::g(int argc, BValue* argv)
{
	const BColor& color = argv[0];
	argv[0] = color.g();
}
void ClassColor::b(int argc, BValue* argv)
{
	const BColor& color = argv[0];
	argv[0] = color.b();
}
void ClassColor::a(int argc, BValue* argv)
{
	const BColor& color = argv[0];
	argv[0] = color.a();
}

void ClassColor::gray(int argc, BValue* argv)
{
	const BColor& color = argv[0];
	argv[0] = color.gray();
}
void ClassColor::reverse(int argc, BValue* argv)
{
	const BColor& color = argv[0];
	argv[0] = color.reverse();
}
void ClassColor::inverse(int argc, BValue* argv)
{
	const BColor& color = argv[0];
	argv[0] = color.inverse();
}

void ClassColor::assign_color(int argc, BValue* argv)
{
	BColor& color = argv[0];
	BColor other = argv[1];
	color = other;
}

void ClassColor::equal(int argc, BValue* argv)
{
	BColor color = argv[0];
	BColor other = argv[1];
	argv[0] = color == other;
}
void ClassColor::unequal(int argc, BValue* argv)
{
	BColor color = argv[0];
	BColor other = argv[1];
	argv[0] = color != other;
}

void ClassColor::less(int argc, BValue* argv)
{
	BColor color = argv[0];
	BColor other = argv[1];
	argv[0] = color < other;
}
void ClassColor::less_equal(int argc, BValue* argv)
{
	BColor color = argv[0];
	BColor other = argv[1];
	argv[0] = color <= other;
}

void ClassColor::greater(int argc, BValue* argv)
{
	BColor color = argv[0];
	BColor other = argv[1];
	argv[0] = color > other;
}
void ClassColor::greater_equal(int argc, BValue* argv)
{
	BColor color = argv[0];
	BColor other = argv[1];
	argv[0] = color >= other;
}

void ClassColor::plus_byte(int argc, BValue* argv)
{
	BColor color = argv[0];
	BByte byte = argv[1];
	argv[0] = color + byte;
}
void ClassColor::plus_color(int argc, BValue* argv)
{
	BColor color = argv[0];
	BColor other = argv[1];
	argv[0] = color + other;
}

void ClassColor::plus_assign_byte(int argc, BValue* argv)
{
	BColor color = argv[0];
	BByte byte = argv[1];
	color += byte;
}
void ClassColor::plus_assign_color(int argc, BValue* argv)
{
	BColor& color = argv[0];
	BColor other = argv[1];
	color += other;
}

void ClassColor::minus_byte(int argc, BValue* argv)
{
	BColor color = argv[0];
	BByte byte = argv[1];
	argv[0] = color - byte;
}
void ClassColor::minus_color(int argc, BValue* argv)
{
	BColor color = argv[0];
	BColor other = argv[1];
	argv[0] = color - other;
}

void ClassColor::minus_assign_byte(int argc, BValue* argv)
{
	BColor color = argv[0];
	BByte byte = argv[1];
	color -= byte;
}
void ClassColor::minus_assign_color(int argc, BValue* argv)
{
	BColor& color = argv[0];
	BColor other = argv[1];
	color -= other;
}

void ClassColor::mult(int argc, BValue* argv)
{
	BColor color = argv[0];
	BByte mult = argv[1];
	argv[0] = color * mult;
}
void ClassColor::mult_assign(int argc, BValue* argv)
{
	BColor& color = argv[0];
	BByte mult = argv[1];
	color *= mult;
}

void ClassColor::div(int argc, BValue* argv)
{
	BColor color = argv[0];
	BByte div = argv[1];
	argv[0] = color / div;
}
void ClassColor::div_assign(int argc, BValue* argv)
{
	BColor& color = argv[0];
	BByte div = argv[1];
	color /= div;
}

void ClassColor::mod(int argc, BValue* argv)
{
	BColor color = argv[0];
	BByte gray = argv[1];
	argv[0] = color % gray;
}
void ClassColor::mod_assign(int argc, BValue* argv)
{
	BColor& color = argv[0];
	BByte gray = argv[1];
	color %= gray;
}
